package com.example.zk2_lx.register;

import androidx.lifecycle.MutableLiveData;

import com.example.zk2_lx.mvvm_base.BaseRepo;
import com.hyphenate.exceptions.HyphenateException;

public class RegisterRepo extends BaseRepo {
    public void register(String name, String pwd, MutableLiveData<String> success,MutableLiveData<String> fail){
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    emClient.createAccount(name,pwd);
                    success.postValue("注册成功");
                } catch (HyphenateException e) {
                    //throw new RuntimeException(e);
                    fail.postValue("注册失败:"+e.getMessage());
                }
            }
        }).start();
    }
}
